/*
 * $Id: MainApp.h,v 1.2 2005-11-22 11:22:33 bacon Exp $
 */

#ifndef _MAINAPP_CLASS_
#define _MAINAPP_CLASS_

#include <xpp/Uncopyable.h>
#include "TcpGate.h"

class MainApp: public xpp::Uncopyable
{
public:
	friend class AppEnv;

	MainApp ();
	virtual ~MainApp ();

	int run ();
	int stop ();
	int stopWithCode (int code);

	int returnCode () const
	{
		return ret_code;
	}

	bool isStopRequested () const
	{
		return stop_requested;
	}

protected:
	int  ret_code;
	bool stop_requested;

	Mutex startup_mutex;
	TcpGate tcp_gate;
	int run_main_task (void);
};

#endif
